﻿import java.util.*;
public class Hui_5_4_Test_02 {
/*
 * 	问题：查询商品价格。
 * 		用户从控制台输入需要查询的商品编号，根据编号显示对应的商品价格。假设商品价格名称和商品价格：T恤￥245.0，网球鞋￥570.0，网球拍￥320.0。
 */
	public static void main(String[] args) {
		String name = "";
		double price = 0.0;
		int num = 0;
		System.out.println("Myshopping管理系统   > 购物结算\n");
		System.out.println("****************************************************************");
		System.out.println("请选择购买的商品编号：");
		System.out.println("1. T恤\t2. 网球鞋\t3. 网球拍");
		System.out.println("****************************************************************\n");
		Scanner input = new Scanner(System.in);
		String answer = "y";
		while(answer.equals("y")){
		System.out.print("请输入商品编号：");
		num = input.nextInt();
		switch(num){
			case 1:
				name = "T恤";
				price = 245.0;
				break;
			case 2:
				name = "网球鞋";
				price = 570.0;
				break;
			case 3:
				name = "网球拍";
				price = 320.0;
				break;
		}
		System.out.println(name + "\t" + "￥" + price + "\n");
		System.out.println("是否继续(y/n):");
		answer = input.next();
		}
		System.out.println("程序结束！");
	}
}